<?php
namespace App\Http\Requests;

class AreaRequest extends Request
{
    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        return [
            'area_name'         => 'required',
            'area_sort'         => 'required|numeric',
        ];
    }

    public function messages()
    {
        return [
            'area_name.required' => '请输入区域名称',
            'area_sort.required' => '请输入区域排序',
            'area_sort.numeric' => '排序请输入数字',
        ];
    }

    public function response(array $errors)
    {
        $jsonData = [
            'status'  => '0',
            'message' => current($errors)[0],
        ];
        return response()->json($jsonData);
    }
}